<body>
    <div class="layui-layout layui-layout-admin">
        <div class="layui-header header header-demo">
            <div class="layui-main">
                <a class="logo" href="{:U('admin/index/index')}">
                    仿LayUI社区后台系统
                </a>
                <ul class="layui-nav" lay-filter="">
                  <li class="layui-nav-item"><img src="__PUBLIC__/images/admin_logo.png" class="layui-circle" style="border: 2px solid #A9B7B7;" width="35px" alt=""></li>
                  <li class="layui-nav-item">
                    <a href="javascript:;"><?php echo $_SESSION['aname']; ?></a>
                    <dl class="layui-nav-child"> <!-- 二级菜单 -->
                      <dd><a href="">个人信息</a></dd>
                      <dd><a href="">切换帐号</a></dd>
                      <dd><a href="javascript:void(0);" id="loginout">退出</a></dd>
                    </dl>
                  </li>
                  <li class="layui-nav-item">
                    <a href="" title="消息">
                        <i class="layui-icon" style="top: 1px;">&#xe63a;</i>
                    </a>
                    </li>
                  <li class="layui-nav-item"><a href="{:U('home/index/index')}">前台首页</a></li>
                </ul>
            </div>
        </div>
        <div class="layui-side layui-bg-black">
            <div class="layui-side-scroll">
                <ul class="layui-nav layui-nav-tree site-demo-nav" lay-filter="side">
                    <?php foreach ($nav as $nk => $nv) { ?>
                        <li class="layui-nav-item">
                            <a class="javascript:; disable;" href="javascript:;">
                                <i class="layui-icon" style="top: 3px;">{:C($nk)}</i><cite>{$nk}</cite>
                            </a>
                            <dl class="layui-nav-child">
                                <?php foreach ($nv as $nvk => $nvv) { ?>
                                    <dd class="">
                                        <dd class="">
                                            <a href="javascript:;" _href="{:U($nvv[0])}">
                                                <cite>{$nvk}</cite>
                                            </a>
                                        </dd>
                                    </dd>
                                <?php } ?>
                            </dl>
                        </li>
                    <?php } ?>
                </ul>
            </div>
        </div>
        <div class="layui-tab layui-tab-card site-demo-title" lay-filter="x-tab" lay-allowclose="true">
            <ul class="layui-tab-title">
                <li class="layui-this">
                    我的桌面
                </li>
            </ul>
            <div class="layui-tab-content site-demo site-demo-body">
                <div class="layui-tab-item layui-show">
                    <iframe frameborder="0" src="{:U('admin/index/welcome')}" class="x-iframe" id="x-iframe"></iframe>
                </div>
            </div>
        </div>
        <div class="site-tree-mobile layui-hide">
            <i class="layui-icon">
                &#xe602;
            </i>
        </div>
        <div class="site-mobile-shade">
        </div>
    </div>
    <script>
    layui.use(['layer'],function(){
        $ = layui.jquery;
        var layer = layui.layer;
        $('#loginout').click(function(){
            layer.confirm('确定退出?', {icon: 3, title:'提示'}, function(index){
                $.ajax({
                    url: '{:U("admin/login/logout")}',
                    type: 'POST',
                    dataType: 'json',
                })
                .done(function(response) {
                    if (response.info) {
                        layer.msg(response.info, {icon: 6},function () {
                            location.href = "{:U('admin/index/index')}";
                        });
                    } else {
                        layer.msg('不明原因退出失败', {icon: 5});
                    }
                })
                .fail(function() {
                    console.log("error");
                });
                layer.close(index);
            });
        });
    });
    </script>
</body>